<?php

namespace App\Console;

use App\model\RobotConfig;
use Carbon\Carbon;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [

    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
      /*   $schedule->command('jinri:project  zhongheng')
                  ->everyMinute()->withoutOverlapping();
         $schedule->command('jinri:project  huatengB')
                  ->everyMinute()->withoutOverlapping();
        $schedule->command('jinri:project  huatengB1')
            ->everyMinute()->withoutOverlapping();
        $schedule->command('jinri:project  huatengB2')
            ->everyMinute()->withoutOverlapping();
         $schedule->command('jinri:project  huatengA')
                  ->everyMinute()->withoutOverlapping();
         $schedule->command('jinri:project  huatengA1')
                  ->everyMinute()->withoutOverlapping();
         $schedule->command('jinri:project  huatengA2')
                  ->everyMinute()->withoutOverlapping();
        $schedule->command('jinri:project  weihe')
            ->everyMinute()->withoutOverlapping();*/
        $schedule->command('user:fenshu')
            ->everyMinute()->withoutOverlapping();
       $schedule->command('newSea')
            ->everyFiveMinutes()->withoutOverlapping();
        $schedule->command('jinri')
            ->everyMinute()->withoutOverlapping();
        $schedule->command('lock')
            ->everyMinute()->withoutOverlapping();
       $schedule->command('dianxiao')
            ->everyMinute()->withoutOverlapping();
       $schedule->command('wechat:name')
            ->everyMinute()->withoutOverlapping();
       $schedule->command('admin:record')
            ->everyFiveMinutes()->withoutOverlapping();
        $schedule->command('xupengfei')
            ->everyMinute()->withoutOverlapping();
/*  $schedule->command('dalang 62')
            ->dailyAt("9:00")->withoutOverlapping(); *///郑雅文
     /*   $schedule->command('dalangzheng')
            ->dailyAt("9:00")->withoutOverlapping(); //王织网
   $scheddalangzhengule->command('dalang 43')
            ->dailyAt("9:00")->withoutOverlapping(); //温驾驭*/
        $schedule->command('dalang 20')
            ->dailyAt("9:00")->withoutOverlapping();
        $schedule->command('xunke 45')
            ->dailyAt("9:00")->withoutOverlapping();
        $schedule->command('hengchuang 184')
            ->dailyAt("9:00")->withoutOverlapping();
        $schedule->command('hengchuang 183')
            ->dailyAt("9:00")->withoutOverlapping();
        $schedule->command('hengchuang 182')
            ->dailyAt("9:00")->withoutOverlapping();
      /*  $schedule->command('xunke 78')
            ->dailyAt("9:00")->withoutOverlapping();
        $schedule->command('xunke 165')
            ->dailyAt("9:00")->withoutOverlapping();*/
        $schedule->command('hengdong 20')
            ->dailyAt("9:00")->withoutOverlapping();
       /* $schedule->command('hengdong22 15')
            ->dailyAt("9:00")->withoutOverlapping();*/

        $schedule->command('huixun 10')
            ->dailyAt("9:00")->withoutOverlapping();
    /*    $schedule->command('dongguan 175')
          ->dailyAt("9:00")->withoutOverlapping(); //黄丽君*/
        $schedule->command('dongguan 105')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君

        $schedule->command('huangjin 5')
            ->dailyAt("9:00")->withoutOverlapping(); //杨金水
        $schedule->command('hengdonghuixun 43')
            ->dailyAt("9:00")->withoutOverlapping(); //文驾驭
        $schedule->command('hengdonghuixun 144')
            ->dailyAt("9:00")->withoutOverlapping(); //叶伟乐
        $schedule->command('hengdonghuixun 137')
            ->dailyAt("9:00")->withoutOverlapping(); //文驾驭
        $schedule->command('huixunHengdong 175')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君
        $schedule->command('huixunHengdong 138')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君
        $schedule->command('huixunHengdong 138')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君
        $schedule->command('huixunHengdong1 45')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君
        $schedule->command('huixunHengdong1 78')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君
        /*$schedule->command('huixunHengdong1 167')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君*/

       /* $schedule->command('dalang 45')
            ->dailyAt("9:00")->withoutOverlapping(); //晏秀源*/
       /* $schedule->command('dalang 144')
            ->dailyAt("9:00")->withoutOverlapping();*/ //叶伟乐
      /*  $schedule->command('dalang 165')
       leads:changeleads:change     ->dailyAt("9:00")->withoutOverlapping(); //杨金水
        $schedule->command('dalang 137')
            ->dailyAt("9:00")->withoutOverlapping(); //陈秀菊
      */

        $schedule->command('guangte 40')
            ->dailyAt("9:00")->withoutOverlapping(); //黄丽君
         $schedule->command('workUser:pull')
                  ->everyFiveMinutes()->withoutOverlapping();
      //  $schedule->command('leads:change')->daily()->withoutOverlapping();
        $robot= RobotConfig::where('is_display',0)->get();
        if ($robot->isNotEmpty()){
            foreach ($robot as $item){
                $time=Carbon::parse($item->send_time)->format("H:i");
                $schedule->command("robot:message $item->id")
                    ->dailyAt($time)->withoutOverlapping();
            }
        }

    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');
        require base_path('routes/console.php');

    }
}
